import React, { Component } from 'react'

export default class Ref1 extends Component {

  //声明回调
  show = () => {
    //查看 ref 属性
    // console.log(<input type="text" ref="input" />); // React.createElement('input')
    //获取 input 元素
    let v = this.refs.input.value;
    //设置
    this.refs.result.innerHTML = v;
  }

  render() {
    return (
      <div>
        <input type="text" ref="input" /> <button onClick={this.show}>显示</button>
        <hr />
        <div ref="result" id="result" style={{width: '400px', height: '300px', border: 'solid 1px #aaa'}}></div>

      </div>
    )
  }
}
